/**
 * Description:一些注释<br/>
 * CreateTime:2019-03-27<br/>
 * Creater: yangpengfei360@126.com <br/>
 * @author yangpengfei
 */
package cn.cnsy123.bookwebsiteserver.controller.index;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.cnsy123.bookwebsiteserver.properties.DefaultPropertiesConfig;

/**
 * Description:一些注释<br/>
 * CreateTime:2019-03-27<br/>
 * Creater: yangpengfei360@126.com <br/>
 * @author yangpengfei
 */
@Controller
public class PageController {
    
    
    @Autowired
    private DefaultPropertiesConfig defaultPropertiesConfig;
    
    @GetMapping(value = "/indexPage")
    public ModelAndView toIndex() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("index");
        modelAndView.setStatus(HttpStatus.OK);
        Map<String, String> modelMap = new HashMap<String, String>();
        modelMap.put("sys_name", defaultPropertiesConfig.getSystemName());
        modelAndView.addAllObjects(modelMap);
        return modelAndView;
    }
    
    @GetMapping(value = "/")
    public String homePage() {
        return "redirect:/indexPage";
    }
    
    @GetMapping(value = "/roleManager")
    public ModelAndView toRoleManager() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("roleManager");
        modelAndView.setStatus(HttpStatus.OK);
        return modelAndView;
    }
    
    
    
}
